import requests

content = input('请输入搜索内容:')
url = 'https://www.sogou.com/web'

# 拼接搜索的参数
params = {
    "query": content
}
# 添加请求头
headers = {
    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"
}

# 请求数据
response = requests.get(url, params=params, headers=headers)
result = response.content.decode()

# 输出结果
with open('04getparams.html', 'w') as f:
    f.write(result)
